package com.service.impl;

import com.mapper.UserMapper;
import com.pojo.User;
import com.service.UserService;
import com.util.Pager;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public User searchByUser(String name, String password) {
        return userMapper.searchByUser(name,password);
    }

    @Override
    public Pager<User> searchUserPager(Pager<User> pager) {
        pager.setRows(userMapper.searchUserPager(pager));
        int totl=userMapper.total(pager);
        System.out.println(totl);
        pager.setTotal(totl);
        return pager;
    }

    @Override
    public int deleteUser(Integer uid) {
        return userMapper.deleteUser(uid);
    }

    @Override
    public int update(User user) {
        return userMapper.update(user);
    }

    public int addUser(User user){
        return userMapper.add(user);
    }
}
